package com.org.forex;

import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.GridLayout;
import javax.swing.JPanel;

import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;

public class ResultWindow {

	private JFrame frmResult;
	private ChartPanel pnlSample;
	private ChartPanel pnlNextSample;
	private ChartPanel pnlMatch;
	private JFreeChart sample_chart;
	private JFreeChart next_sample_chart;
	private JFreeChart match_chart;
	private JFreeChart next_match_chart;
	private JPanel pnlMatchNext;
	private String title;

	public ResultWindow(JFreeChart sample_chart, JFreeChart next_sample_chart,
			JFreeChart match_chart, JFreeChart next_match_chart, String title) {
		super();
		this.sample_chart = sample_chart;
		this.next_sample_chart = next_sample_chart;
		this.match_chart = match_chart;
		this.next_match_chart = next_match_chart;
		this.title = title;
		initialize();
	}

	/**
	 * Launch the application.
	 */
	public void show() {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					frmResult.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public ResultWindow() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frmResult = new JFrame();
		frmResult.setTitle("Result");
		frmResult.setBounds(100, 100, 1076, 572);
		frmResult.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frmResult.setResizable(false);
		frmResult.setTitle(title);
		frmResult.getContentPane().setLayout(null);

		pnlSample = new ChartPanel(sample_chart);
		pnlSample.setBounds(10, 11, 501, 256);
		frmResult.getContentPane().add(pnlSample);

		pnlNextSample = new ChartPanel(next_sample_chart);
		pnlNextSample.setBounds(521, 11, 529, 256);
		frmResult.getContentPane().add(pnlNextSample);

		pnlMatch = new ChartPanel(match_chart);
		pnlMatch.setBounds(10, 278, 501, 245);
		frmResult.getContentPane().add(pnlMatch);

		pnlMatchNext = new ChartPanel(next_match_chart);
		pnlMatchNext.setBounds(521, 279, 529, 244);
		frmResult.getContentPane().add(pnlMatchNext);
	}
}
